{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "with open('cn_all.txt',\"r\") as f1:\n",
    "    cn = f1.read()\n",
    "cn = cn.split('\\n')\n",
    "\n",
    "with open('en_all.txt',\"r\") as f2:\n",
    "    en = f2.read()\n",
    "en = en.split('\\n')"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "cn_set = pd.DataFrame(list(set(cn))) # list去重\n",
    "en_set = pd.DataFrame(list(set(en))) # list去重"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "with open('cn_set.txt','w',encoding='UTF-8') as outfile1:\n",
    "    cn_set.to_string(outfile1, index=False, header=None)\n",
    "    \n",
    "with open('en_set.txt','w',encoding='UTF-8') as outfile2:\n",
    "    en_set.to_string(outfile2, index=False, header=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "with open('raw.txt',\"r\") as f1:\n",
    "    raw = f1.read()\n",
    "raw = raw.split('\\n')\n",
    "en_set = pd.DataFrame(list(set(raw))) # list去重\n",
    "with open('set.txt','w',encoding='UTF-8') as outfile:\n",
    "    en_set.to_string(outfile, index=False, header=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
